package com.zf.shuashua.ui.popup;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.zf.shuashua.R;

/**
 * 通知栏提示弹框
 */
public class NoticeTipDialog extends Dialog {

    private TextView btnTitle;
    private ImageView imgClose;
    private OnPopupListener mListener;

    public NoticeTipDialog(@NonNull Context context) {
        super(context);
    }

    public void setPopupListener(OnPopupListener listener) {
        this.mListener = listener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.popup_notice);
        try {
            getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        } catch (Exception e) {

        }
        btnTitle = findViewById(R.id.btTitle);
        imgClose = findViewById(R.id.img_close);
        btnTitle.setOnClickListener(v -> {
            dismiss();
            if (mListener != null) {
                mListener.onNext();
            }
        });
        imgClose.setOnClickListener(v -> {
            dismiss();
            if (mListener != null) {
                mListener.onClose();
            }
        });
    }

}

